<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
	<head> 
    <meta charset="UTF-8">
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
    <script src="${ctxStatic}/js/DateTimePicker.js"></script>
    <script src="${ctxStatic}/js/layer.js"></script>
    <script src="${ctxStatic}/js/style.js"></script>
    <script src="${ctxStatic}/dateCalendar/WdatePicker.js"></script>
    <link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
    <link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
    <script>
   $(document).ready(function(){	
       $("#styleCategoryCD").select2();
	   var form = $("#inputForm");  
       form.validate();//验证指定的表单
   		$("#confirmBtn").click(function(){
   		if (form.valid()) {//如果表单验证成功，则进行提交。  
	   		$("#showHtml").addClass("showHtml");
	   	 	$("#confirmPage").css("display","block");
	   		$("#editPage").css("display","none");
            $("#showHtml").find("input").removeAttr("disabled");
            $("#showHtml").find("select").removeAttr("disabled");
            $("#showHtml").find("textarea").removeAttr("disabled");
            return false;
         
         	}
    	});
	}); 
   
   /* 保存编辑信息 */
   function editSaveForm(){
	$("#activity_pane").showLoading();
   	$('.showHtml').find('input,select,textarea').attr('disabled',false);	
   	var params = $("#inputForm").serialize();
   	$.post("${ctx}/production/location/save",params,function(result){
   		/* 弹出提示框,刷新父页面,关闭当前页面 */
   		tipParent(result.message);
   		 window.parent.frames[0].searchListForm();
   		$("#activity_pane").hideLoading();
   		closeWin();    		 	
   	},'json');
   }
    

    </script> 
    </head>
	<body id="activity_pane">
	<!-- 创建页面head部 -->
	<div id="editPage" class="layerHeader clearfix">
	
		<c:choose>
	        <c:when test="${productionLocation.id!=null && productionLocation.id!=''}">
	             <!-- 修改编辑 -->
	            <p class="headerTitle"><spring:message code="edit_production_location"/></p>
	        </c:when>
	        <c:otherwise>
	             <!-- 新建 -->
	            <p class="headerTitle"><spring:message code="create_production_location"/></p>
	        </c:otherwise>
	    </c:choose>

	    <div class="headerButton clearfix">
	    <shiro:hasPermission name="produce:procedure:edit">
	       <button type="button" id="confirmBtn"><spring:message code="btn_ok"/></button>
	    </shiro:hasPermission>
	       <button type="button" onclick="closeWin()"><spring:message code="btn_cancle"/></button>
	    </div>
	</div>
	
	<!-- 确认页面head部 -->
	<div id="confirmPage" class="layerHeader clearfix" style="display:none">
		<p class="headerTitle"><spring:message code="production_ok"/></p>
	    <div class="headerButton clearfix">
	        <shiro:hasPermission name="production:location:edit">
	        <button type="button" onclick="editSaveForm()"><spring:message code="common_save"/></button>
 			</shiro:hasPermission>
	        <button type="button" id="backBtn" onclick="closeWin()"><spring:message code="btn_cancle"/></button>
	    </div>
	</div>

    <form id="inputForm" method="post" >
    <input type="hidden" id="id" name="id" value="${productionLocation.id}"/>
    <input type="hidden" id ="createUser" value="${productionLocation.createBy.firstName}${productionLocation.createBy.lastName}">
<div id="showHtml">
	<div class="smList">
		        <div class="items clearfix">
	        <c:set value="STYLE_CATEGORY" var="produceparaList" />
						<div class="col-50 clearfix haveToBox">
	        		<!-- 款式类别 -->
						<p class="tit" style="width: 85px;"><spring:message code="fitproperty_styleCategory" /></p>
						<select class="w-styleCategory" id="styleCategoryCD" name="styleCategoryCD" style="width: 150px" data-rule-required="true" data-msg-required="<spring:message code="location_fitproperty_styleCategory"/>">
							<option value=""><spring:message code="order_please_choose" /></option>
							<c:forEach items="${fns:getDictList(produceparaList)}" var="item">
								<option  value="${item.itemCode}-${item.itemValue}" <c:if test="${fn:split(productionLocation.styleCategoryCD,'-')[1] eq item.itemValue }">selected="selected"</c:if>>${item.itemName}</option>
							</c:forEach>
						</select>
						<p class="haveTo">*</p>
	           </div>
	        </div>
	
 			<div class="items clearfix">
	        	<div class="col-50 clearfix haveToBox">
	        		<!-- 定制工序名称 -->
	                <p class="tit" style="width: 85px;"><spring:message code="production_location_name" /></p>
	                <input type="text" id="itemNameCn" name="itemNameCn" value="${productionLocation.itemNameCn}" data-rule-required="true" data-msg-required="<spring:message code="location_produce_pleaseInputName"/>"/>
	                <p class="haveTo">*</p>
	            </div>
	        </div>
	        
	        <div class="items clearfix">
	        	<div class="col-50 clearfix haveToBox">
	        		<!-- 定制工序简称 -->
	                <p class="tit" style="width: 85px;"><spring:message code="production_location_shortName" /></p>
	                <input type="text" id="itemShortNameCn" name="itemShortNameCn" value="${productionLocation.itemShortNameCn}" data-rule-required="true" data-msg-required="<spring:message code="location_produce_pleaseInputShortName"/>"/>
	                <p class="haveTo">*</p>
	            </div>
	        </div>
	        
	         <div class="items clearfix">
	        	<div class="col-50 clearfix haveToBox">
	        		<!-- 定制工序Mac地址 -->
	                <p class="tit" style="width: 85px;"><spring:message code="production_location_mac" /></p>
	                <input id="itemAddress" name="itemAddress" value="${productionLocation.itemAddress}">
	            </div>
	        </div>
	        
	        
	           <div class="items clearfix">
	        	<div class="col-50 clearfix haveToBox">
	        		<!-- 定制工序IP -->
	                <p class="tit" style="width: 85px;"><spring:message code="production_location_IP" /></p>
	                <input id="itemIP" name="itemIP" value="${productionLocation.itemIP}">
	            </div>
	        </div>
	        
	        <div class="items clearfix">
	        	<div class="col-50 clearfix haveToBox">
	        		<!-- 定制工序SORT -->
	                <p class="tit" style="width: 85px;"><spring:message code="production_location_sort" /></p>
	                <input id="itemSort" name="itemSort" value="${productionLocation.itemSort}" data-rule-required="true" data-msg-required="<spring:message code="location_produce_pleaseInputSort"/>"/>
	            	<p class="haveTo">*</p>
	            </div>
	        </div>

	        <div class="items clearfix">
	        	<div class="col-50 clearfix">
	        		<!--状态-->
					<p class="tit" style="width: 85px;"><spring:message code="dict_state" /></p>
					<div class="labelBox">
						<!--启用-->
						<label> <input type="radio" name="enableFlag" value="1" checked="checked"
							<c:if test="${productionLocation.enableFlag eq 1}">checked="checked"</c:if>
							class="rast" /> <spring:message code="dict_enable" /> 
						</label>
						<!--停用-->
						<label><input type="radio" name="enableFlag" value="0"
							<c:if test="${productionLocation.enableFlag eq 0}">checked="checked"</c:if>
							class="rast" /> <spring:message code="dict_disable" /> 
						</label>
					</div>
	            </div>
	        </div>
	        
	        <div class="items clearfix">
	        	<div class="col-50 clearfix">
	        		<!--机台显示-->
					<p class="tit" style="width: 85px;"><spring:message code="production_machine_showFlag" /></p>
					<div class="labelBox">
						<!--显示-->
						<label> <input type="radio" name="itemShowFlag" value="1"
							<c:if test="${productionLocation.itemShowFlag eq 1}">checked="checked"</c:if>
							class="erast" /> <spring:message code="production_flag_show" /> 
						</label>
						<!--不显示-->
						<label><input type="radio" name="itemShowFlag" value="0"
							<c:if test="${productionLocation.itemShowFlag eq 0}">checked="checked"</c:if>
							class="erast" /> <spring:message code="production_flag_hide" /> 
						</label>
					</div>
	            </div>
	        </div>
	        
	        <div class="items clearfix">
	        	<div class="col-50 clearfix">
	        		<!--导出标识-->
					<p class="tit" style="width: 85px;"><spring:message code="production_location_exportFlag" /> </p>
					<div class="labelBox">
						<!--导出-->
						<label> <input type="radio" name="itemExportFlag" value="1"
							<c:if test="${productionLocation.itemExportFlag eq 1}">checked="checked"</c:if>
							class="erast" /> <spring:message code="production_flag_export" /> 
						</label>
						<!--不导出-->
						<label><input type="radio" name="itemExportFlag" value="0"
							<c:if test="${productionLocation.itemExportFlag eq 0}">checked="checked"</c:if>
							class="erast" /> <spring:message code="production_flag_unExport" /> 
						</label>
					</div>
	            </div>
	        </div>
	        
	           <div class="items clearfix">
	        	<div class="clearfix haveToBox">
	        		<!-- 描述 -->
	                <p class="tit"><spring:message code="dict_remarks" /></p>
	                <textarea  id="remarks" name="remarks" style="width: 400px ;height: 80px"  value="${productionLocation.remarks}">${productionLocation.remarks}</textarea>
	            </div>
	        </div>
	</div>
</div>
</form>
</body>
</html>